<div  title="班级成绩录入"  class="container">
    <div class="form-group" style="margin-top: 20px">
     <form class="form-inline">
		 
		<label>选择班级：</label><input id="bj" class="form-control"  />
		<label>选择课程：</label><input id="kc" disabled="true" class="form-control" />
		<button  id="cx" type="button">查询</button>
	 </form>
	
    </div>
		<div id="div" class="container" >
			<table id="mytable">
			</table>
		</div>
</div>
<script type="text/javascript">
$(function(){
   $('#bj').combobox({
	   url:'banji/list',
		valueField:'id',
		textField:'name',
		editable:false,//不能输入东西
		onchange:function(id){
                var bjId=id;
                $('#kc').combobox({
                	url:'course/list?bjId+'+bjId,
					valueField:'id',
					textField:'name',
					editable:false,
                     });
			}
		   });
     $('#cx').bind('click',function(){
             var  bjId=$('#bj').combobox('getValue');
             var  kcId=$('#kc').combobox('getValue');    
               $('#mytable').datagrid({
                        url:'grade/page?bjId='+bjId+'&kcId='+kcId,
                        searchUrl:'',
                         search:false,    //不显示搜索框
                         editable:false,    //不能输入东西
                         pagination:true, //不显示分页；
                         buttons:[],
                         columns:[
                             [ 
                            	 {title:'aa',field:'aa',checkbox:true},
                                 {field:'student.name',title:'姓名'},
                                 {field:'grade',title:'成绩',formatter: function formatOper(val, row, index){ 
                 					if(row.grade==null){
                 						
             					       row.grade=0;
             						 	}
             						 return '<input type="number" class="form-control" onchange="xg('+row.id+',value)" id="input" value="'+row.grade+'"/>';
             				}},
                                 ]
                             ],
                         
                   })
         })
  })
  function xg(id,grade){
		if(!(/^[0-9]\d*$/.test(grade))){
			bootbox.alert('提示','请输入正整数','info');
			return;
		};
	$.post('grade/xgcj',{id:id,grade:grade},function(data){});
	}
</script>